package singleton;

/**
 * 单例模式：饿汉式
 *
 * 1. 构造方法私有
 * 2. 声明一个已初始化好的静态变量
 */
public class Singleton01 {

    public static final Singleton01 INSTANCE = new Singleton01();

    private Singleton01(){}


    public static void main(String[] args) {
        Singleton01 i1 = Singleton01.INSTANCE;
        Singleton01 i2 = Singleton01.INSTANCE;
        System.out.println(i1 == i2);
    }
}
